﻿<%@ Page Language="C#" MasterPageFile="~/Base.Master" AutoEventWireup="true" CodeBehind="TransactionTypesRelations.aspx.cs" Inherits="SVAccountingWebUI.TransactionTypesRelations" %>
<%@ MasterType VirtualPath="~/Base.Master" %>

<asp:Content ID="TransactionTypesRelations" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" 
        DataSourceID="LDSTransactionTypesRelations"
        onrowdeleting="gv_RowDeleting" 
        DataKeyNames="OwnesID, ReqID"
        >
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" 
                        CommandName="Delete" ImageUrl="~/Icons/delete.png" Text="Delete"
                        message="<%$ Resources:Resource, DeleteConfirm %>" 
                        OnClientClick='return confirm(this.getAttribute("message"))'
                        />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="OwnesID" HeaderText="<%$ Resources:Resource, OwnesID %>" 
                SortExpression="OwnesID" />
            <asp:BoundField DataField="ReqID" HeaderText="<%$ Resources:Resource, ReqID %>" SortExpression="ReqID" />
        </Columns>
    </asp:GridView>

    <asp:LinqDataSource ID="LDSTransactionTypesRelations" runat="server" 
        ContextTypeName="SVAccountingBL.SVALinqDataContext" EnableDelete="True" 
        EnableInsert="True" TableName="TransTypeRelations"
        ondeleted="LinqDataSource_Deleted" 
        oninserted="LinqDataSource_Inserted" 
        oninserting="LinqDataSource_Inserting"
        >
    </asp:LinqDataSource>


<asp:UpdatePanel ID="AddNewPanel" runat="server">
   <ContentTemplate>
    <br />
    <asp:LinkButton ID="lbtnAddNew" runat="server" 
                    Text="<%$ Resources:Resource, AddNew %>" 
           onclick="AddNew_Click"/>
    <br />
    <br />
   <div ID="InsertDiv" runat="server" visible="false">
       <asp:DetailsView ID="dvInsertNew" runat="server" Height="50px" Width="125px" 
           AutoGenerateRows="False" DataSourceID="LDSTransactionTypesRelations" 
           DefaultMode="Insert"
          onitemcommand="InsertDV_ItemCommand"
           >
           <Fields>
               <asp:BoundField DataField="OwnesID" HeaderText="<%$ Resources:Resource, OwnesID %>" 
                   SortExpression="OwnesID" />
               <asp:BoundField DataField="ReqID" HeaderText="<%$ Resources:Resource, ReqID %>" SortExpression="ReqID" />
               <asp:CommandField ButtonType="Image" CancelImageUrl="~/Icons/Cancel.png" 
                   InsertImageUrl="~/Icons/Add.png" ShowInsertButton="True" />
           </Fields>
       </asp:DetailsView>
    </div>
    </ContentTemplate>
    
    <Triggers>
         <asp:AsyncPostBackTrigger ControlID="lbtnAddNew" EventName="click" />
         <asp:PostBackTrigger ControlID="dvInsertNew" /> 
    </Triggers>
    
   </asp:UpdatePanel>


</asp:Content>
